﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using DotNetNuke;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Services.Search;

namespace YourCompany.Modules.Cafeteria
{
	public class CafeteriaOrderController
	{

		#region public method

		public List<CafeteriaOrder> GetOrderList()
		{
			return CBO.FillCollection<CafeteriaOrder>(DataProvider.Instance().GetOrderList());
		}

		public CafeteriaOrder GetOrder(int OrderID)
		{
			return (CafeteriaOrder)CBO.FillObject(DataProvider.Instance().GetOrder(OrderID), typeof(CafeteriaOrder));
		}

		public void AddOrder(CafeteriaOrder cafeteriaOrder)
		{
			DataProvider.Instance().AddOrder(cafeteriaOrder.ItemID, cafeteriaOrder.ItemQuantity, cafeteriaOrder.Room, cafeteriaOrder.TotalPrice, cafeteriaOrder.Time, cafeteriaOrder.ByUser, cafeteriaOrder.Completed);
		}

		public void UpdateOrder(CafeteriaOrder cafeteriaOrder)
		{
			DataProvider.Instance().UpdateOrder(cafeteriaOrder.OrderID, cafeteriaOrder.ItemID, cafeteriaOrder.ItemQuantity, cafeteriaOrder.Room, cafeteriaOrder.TotalPrice, cafeteriaOrder.Time, cafeteriaOrder.ByUser, cafeteriaOrder.Completed);
		}

		public void DeleteOrder(CafeteriaOrder cafeteriaOrder)
		{
			DataProvider.Instance().DeleteOrder(cafeteriaOrder.OrderID);
		}

		#endregion

	}
}
